<!DOCTYPE html>
<html lang="zh-CN">

	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>应急处理</title>
		<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
		
		<link rel="stylesheet" href="css/animate.css">
		<link rel="stylesheet" href="css/global.css">
		<link rel="stylesheet" href="css/loading.css">
		<style>
			tr {border-bottom: 1px solid lightgray;}
			img {width: 80px;height: 80px;margin: 10px;}
			.ui-btn-icon-right ui-icon-carat-r {display: none;}
			a.aft:after {display: none;}
			.red {border: 1px solid red !important;}
			.blue{background: #0220a4;}
			.head_top{width: 100%;height:5px;margin-bottom: 4px;background: #0220a4;}
			.head_bottom{width: 100%;height:5px;margin-top: 1px;background: #0220a4;}

			.ui-page-theme-a .ui-bar-inherit{background: #0220a4;color: #fff;font-weight: normal;}
			.ui-page-theme-a .ui-btn{background: #0220a4;color: #fff;text-shadow: 0 0px 0 #f3f3f3;border: 0px;font-size: 14px;border-radius: 0px;}

			.form_div{display: flex;align-items: center;justify-content: space-between;color: #8a8889;border-bottom: 1px solid #ccc;}
			.form_div input{color: #000;}
			.ui-page-theme-a .ui-btn:hover{background: #0220a4;color: #fff;text-shadow: 0 0px 0 #f3f3f3;border: 0px;font-size: 14px;border-radius: 0px;}
		</style>
	</head>

	<body>
		<div data-role="page" style="background: #fff;">
			<div class="blue head_top"></div>
			<div data-role="header">
				<h1>应急处理</h1>
			</div>
			<div class="blue head_bottom"></div>
			<div data-role="main" class="ui-content">
				<form>
					<div class="form_div">
						<label for="fname">请输入姓名</label>
						<input type="text" placeholder="" name="name" id="name">
					</div>
					<div class="form_div">
						<label for="fname">请输入手机号</label>
						<input type="number" placeholder="" name="phone" id="phone">
					</div>
					<div class="form_div">
						<label for="fname">请输入地址</label>
						<input type="text" placeholder="" readonly name="address" id="place">
					</div>
					<div class="form_div" style="display: block;margin: 10px 0px;">
						<!-- <label for="fname">请输入事由</label> -->
						<!-- <input type="text" placeholder="请输入事由" name="msg" id="reason"> -->
						<textarea placeholder="请输入事由" rows="3" name="msg" id="reason"></textarea>
					</div>

					<input type="hidden" value="333" name="openid" id="openid">
					<input type="hidden" value="" name="sections_id" id="sections_id">
					<!--<input type="button" onclick="jb()" value="提交">-->
				</form>
					<button onclick="jb()">提交</button>
			</div>

		</div>
	</body>

	<script src="js/jquery-2.1.0.js"></script>
	<script src="js/loading.js"></script>
	<script type="text/javascript" src="js/ajax.js" ></script>
	<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
	<script type="text/javascript">		
		function UrlSearch() {
				var name, value;
				var str = location.href; //取得整个地址栏
				var num = str.indexOf("?")
				str = str.substr(num + 1); //取得所有参数   stringvar.substr(start [, length ]
			
				var arr = str.split("&"); //各个参数放到数组里
				for(var i = 0; i < arr.length; i++) {
					num = arr[i].indexOf("=");
					if(num > 0) {
						name = arr[i].substring(0, num);
						value = arr[i].substr(num + 1);
						this[name] = value;
					}
				}
			}
			var Request = new UrlSearch(); //实例化
			var urlData = Request.place;
			var id = Request.sections_id;
			var place =  decodeURI(urlData);
			var sections_id =  decodeURI(id);
			console.log(place);
			$("#sections_id").val(sections_id)
			console.log(sections_id);
			if(place=='undefined'){
				$("#place").val('');
				$("#place").addClass("red");
			}else{
				$("#place").removeClass("red");
				$("#place").val(place);
			}
			

		
		
		
		var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
		var num = /^(-?\d+)(\.|\.\d+)?$/;
		$("input").blur(function() {
			if(this.value=="") {
				$(this).addClass("red");
				console.log(this.value)
				return false;
			}else{
				$(this).removeClass("red");
			}
			if(this.id=="name"){
				if(num.test($("#name").val())) {
	//				alert('请输入有效的手机号码！');
					$(this).addClass("red");
					console.log(this.id)
					return false;
				}else{
					$(this).removeClass("red");
				}
			}
			if(this.id=="phone"){
				if(!myreg.test($("#phone").val())) {
	//				alert('请输入有效的手机号码！');
					$(this).addClass("red");
					console.log(this.id)
					return false;
				}else{
					$(this).removeClass("red");
				}
			}
			
			
			
			
		})
	</script>

</html>